package cn.itcast.nems.studentrecord.enumeration;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 学籍支付流水支付类型
 */
@AllArgsConstructor
@Getter
public enum FundFlowPaymentTypeEnum {

    ONLINE_PAY("在线支付"),
    OFFLINE_PAY("离线支付"),
    REFUND("退费"),
    REFUND_TRANSFER("退转"),
    REFUND_ROLLBACK("退费退回"),
    FUND_TRANSFER("费用转移"),
    ;

    private String desc;

    /**
     * 根据名称匹配枚举
     *
     * @param name 枚举名称
     */
    public static FundFlowPaymentTypeEnum of(String name) throws IllegalArgumentException {
        FundFlowPaymentTypeEnum rangeTypeEnum;
        try {
            rangeTypeEnum = FundFlowPaymentTypeEnum.valueOf(name);
        } catch (IllegalArgumentException e) {
            throw new IllegalArgumentException(String.format("支付类型[%s]不存在或错误！", name));
        }
        return rangeTypeEnum;
    }
}
